package asteroids.model.programs;
/**
 * This class describes a memorycell to store the position, of an object, which is represented with a line and column.
 * It does not store the object, just the position where to retrieve it.
 * @author Thomas
 *
 */
public class MemoryCell {
	public MemoryCell(int line, int column){
		setLine(line);
		setColumn(column);
	}

	public void setLine(int line) throws IndexOutOfBoundsException{
		if(isValidLine(line))
			this.line = line;
		else
			throw new IndexOutOfBoundsException();
	}

	public void setColumn(int column){
		if(isValidColumn(column))
			this.column = column;
		else
			throw new IndexOutOfBoundsException();
	}

	public int getLine(){
		return this.line;
	}

	public int getColumn(){
		return this.column;
	}

	public boolean isValidLine(int line){
		return line>=0;
	}

	public boolean isValidColumn(int column){
		return column >=0;
	}

	private int line;
	private int column;
}
